#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>

using namespace std;
#define int long long
const int N = 2e5 + 10;
int q[N], p[N], cnt[N];
int n;
int dfs(int pos, int x)
{
	for (int i = pos + 1; i <= n; i++)
	{
		if (p[i] - x > x) return n;
		else if (p[i] - x == x)
		{
			if (i == n) return i - pos;
			else return max(i - pos, dfs(i - pos, x));
		}
	}
	return n;
}
void solve()
{
	cin >> n;
	//memset(cnt , 0, sizeof cnt);
	for (int i = 1; i <= n; i++)
		cin >> q[i];
	for (int i = 1; i <= n; i++)
		p[i] = p[i - 1] + q[i];


	int pnt = 1;
	int ma = 0;
	int ans = 0;
	for (int i = pnt; i <= n; i++)
	{
		ans = min(ans, max(i, dfs(i, p[i])));
	}

	cout << ans << endl;
}
signed main()
{
	int t;
	cin >> t;
	while (t--)
		solve();
	return 0;
}